﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Threading.Tasks;

// 模拟帧 FE 00 4D 04 49
namespace LRSystem
{
    public class LRRfModuleRFTx : ISendPacket
    {
        public byte[] data { get; set; } // field. x个字节

        //static private byte[] _data;

        private int size
        {
            get { return data.Length; }
        }

        private byte dataPos
        {
            get { return 0; }
        }

        public const ushort Type = (ushort)0x0B4E;

        //public byte[] BuildCmd()                // 形成完整的packet，包括SOF,LEN,CMD,DATA,FCS
        //{
        //    byte[] cmdbuffer = new byte[size];  // 需要将SOF,LEN,CMD,FCS加进去

        //    data.CopyTo(cmdbuffer, 0);
        //    cmdbuffer = ParkingOriginalPacket.BuildOriginalPacket(cmdbuffer, Type);
        //    return cmdbuffer;
        //}

        public override string ToString()
        {
            string s = string.Format("{0,-25} {1,20} {2,25}", "(Field)", "(Hex)", "(Decimal)");
            s += string.Format("\n{0,-25}|{1,20:X4} {2,25:G}", "Type", Type, this.GetType().Name);
            string str = "";
            for (int i = 0; i < size; i++)
                str += data[i].ToString("X2");
            str += data[size-1].ToString();
            s += string.Format("\n{0,-25}|{1,20} {2,25}", "data", "", str);
            return s;
        }

    }
}